import java.util.*;

public class Test {
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt();
        int r = scanner.nextInt();
        int count = 0;
        for (int i = l; i <= r; i++) {
            int tmp = i;
            while (tmp != 0) {
                if (tmp % 10 == 2) {
                    count++;
                }
                tmp /= 10;
            }
        }
        System.out.println(count);
    }




    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();

        char[] ch = str.toCharArray();
        List<Character> list = new LinkedList<>();

        for (int i = 0; i < ch.length; i++) {
            list.add(ch[i]);
        }
        int left = 0, right = 1;
        while (right < list.size()) {
            if (list.get(left) == list.get(right)) {
                list.remove(left);
                list.remove(left);
                if (left != 0) {
                    left--;
                    right--;
                }
            } else {
                left++;
                right++;
            }
        }
        if(list.isEmpty()){
            System.out.println("0");
        }else {
            for (int i = 0; i < list.size(); i++) {
                System.out.print(list.get(i));
            }
           // System.out.println(list.toString());
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();

        char[] ch = str.toCharArray();
        Stack<Character>stack=new Stack<>();
        for (int i = 0; i < ch.length ; i++) {
            if(!stack.isEmpty()&&stack.peek()==ch[i]){
                stack.pop();
            }
            else {
                stack.push(ch[i]);
            }
        }
        if(stack.isEmpty()){
            System.out.print("0");
        }
        Stack<Character>stack1=new Stack<>();
        while(!stack.isEmpty()){
            stack1.push(stack.pop());
        }
      while (!stack1.isEmpty()){
          System.out.print(stack1.pop());
      }
    }




  /*  public ArrayList<Integer> intersection1 (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        HashSet<Integer>set=new HashSet<>();
        for (int i = 0; i <nums1.size() ; i++) {
            set.add(nums1.get(i));
        }
        List<Integer>ret=new ArrayList<>();
        int []arr=new int[1001];
        for (int i = 0; i <nums2.size() ; i++) {
            int t=nums2.get(i);
            if(set.contains(t)){
                arr[t]++;
            }
        }
        for (int i = 0; i <=1000 ; i++) {
            if(arr[i]!=0){
                ret.add(i);
            }
        }
        return (ArrayList<Integer>) ret;
    }

*/


   /* public static ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        HashSet<Integer>set=new HashSet<>();
        for (int i = 0; i <nums1.size() ; i++) {
         set.add(nums1.get(i));
        }
List<Integer>ret=new ArrayList<>();
        HashSet<Integer>set2=new HashSet<>();
        for (int i = 0; i <nums2.size() ; i++) {
         int t=nums2.get(i);
            if(set.contains(t)){
                set2.add(t);
            }
        }
        for () {

        }
    }
}
*/

}